home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3653 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: GetSystemMetrics
  5. Date: Thu, 25 Jan 1996 12:00:24 +0200
  6. Organization: Carelcomp Forest
  7. Message-ID: <310754B8.596A@cmt.lpr.mail.carel.fi>
  8. References: <4e71gu$ja@kirin.wwa.com>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (WinNT; I)
  14.  
  15. Theo Bals wrote:
  16. > Hi there fellow C programmers
  17. > I am (trying to) use the function 'GetSyetemMetrics' to find out the
  18. > size of a window.
  19. > The documentation supplied with the Microsoft Visual V1.5 complier
  20. > seems to indicate i should use GetsystemMetrics(SM_SXSCREEN) for the
  21. > width and GetSystemMetrics(SM_CYSCREEN) for the height of the window.
  22. > But it looks like these functions always return the values as if the
  23. > window was maximized. I have solved my particular problem by
  24. > 'intercepting' the WM_SIZE message from windows which gives me the size
  25. > of the resized window in lParam but i am wondering if i am doing the
  26. > right thing here.
  27. > As anyone had any problems with this also?
  28. > Theo.
  29.  
  30. Actually, GetSystemMetrics returns information about the _system_, not a single 
  31. window. The values you're referring to return the width and the height of the 
  32. _screen_, not a window. If you know the window handle, you can
  33.  
  34.     RECT    rect;
  35.  
  36.     GetWindowRect(hWnd, &rect);
  37.  
  38. which will give you the rectangle of the window, or
  39.  
  40.     GetClientRect(hWnd, &rect);
  41.  
  42. which will give you the rectangle of the client area of the window.
  43.  
  44. BTW, this kind of questions should be targeted to Windows programming 
  45. newsgroups (such as comp.os.ms-windows.programmer.misc), since they do not deal 
  46. with C++.
  47.  
  48. Later,
  49. AriL
  50.  
  51. -- 
  52. All my opinions are mine and mine alone.
  53.